﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Escape
{
    class GameScreen: Screen
    {
        public static Camera c;
        public static BasicEffect effect;

        public static Area currentArea;
        public static CubeModel cube;

        public static Ray pickRay;

        public override void Init()
        {
            c = new Camera(Basic.device, 0, -0.3f, 0);
            c.EnableMovement(0.033f, 0.01f);

            effect = new BasicEffect(Basic.device);

            currentArea = new Area("Areas\\Area1", "beda");
            cube = new CubeModel();

            Player.init();

            base.Init();
        }

        public override void Update()
        {
            c.Update();
            currentArea.Update();
            pickRay = c.getPickRay();
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                Game1.quit = true;
            base.Update();
        }

        public override void Render()
        {
            effect.View = c.View;
            effect.Projection = c.Projection;

            currentArea.Render();

            Player.render();

            Basic.spriteBatch.DrawString(Basic.littleFont, "Escape Version 0.1", new Vector2(0, 0), Color.White);

            base.Render();
        }
    }
}
